/*
 * @Description: 
 * @version: 1.0
 * @Author: ziwei
 * @Date: 2021-08-15 09:53:58
 * @LastEditors: ziwei
 * @LastEditTime: 2021-08-15 10:37:29
 */
module.exports={
    mode:'development',
    entry:'./src/index.tsx',
    output:{

    },
    devtool:'source-map',
    devServer:{
        hot:true,
        constBase:path.join(__dirname,'public'),//额外的静态文件目录
        historyApiFallback:{
            index:'./index.html',//browserHistory刷新会报错404，所以服务端要重定向
        }
    },
    resolve:{
        alias:{

        },
        extension:['.ts','tsx','js','json']
    },
    module:{//模块 匹配规则
        rules:[
           {
            test:/\.(j|t).sx?$/, 
            user:[{
                loader:'babel-loader'
            }]
           },
           {
               test:/\.less$/,
               user:[
                   "style-loader",{
                       loader:'css-loader'
                   },{
                       loader:'postcss-loader',
                       options:{

                       }
                   },{
                       loader:'pex2rem-loader',//px转换rem
                       options:{
                           remUnit:75,
                           remProcession:8
                       }
                   },
                   'less-loader'// less编译成css
               ]
           },{
               test:/\.(jpg)/
           }
        ]
    }
}